/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.worlds.ui;

import java.io.File;
import java.io.FilenameFilter;
import javax.swing.filechooser.FileFilter;
import net.worlds.Util;


public class ModelFileFilter extends FileFilter implements FilenameFilter{

    public boolean accept(File dir, String name) {
        String extension = Util.getExtension(name);
        return (extension != null && extension.equals("wmodel"));
    }

    @Override
    public String getDescription() {
        return "2DWorlds Models (.wmodel)";
    }

    @Override
    public boolean accept(File f) {
        if (f.isDirectory())
            return true;
        String extension = Util.getExtension(f.getName());
        if(extension != null && extension.equals("wmodel"))
            return true;
        return false;
    }

}
